#pragma once

#include "mat4x4.h"
#include "Plane.h"
#include "tgmath.h"
#include "../AABB.h"

namespace TG
{
	class Frustum
	{
	public:
		enum
		{
			FRUSTUM_LEFT = 0,
			FRUSTUM_RIGHT = 1,
			FRUSTUM_TOP = 2,
			FRUSTUM_BOTTOM = 3,
			FRUSTUM_FAR = 4,
			FRUSTUM_NEAR = 5,
		};

		Plane planes[6];

		Frustum(mat4x4 m);

		bool pointInFrustum(const vec3 &v) const;

		bool pointInFrustum(const vec4 &v) const;

		//bool sphereInFrustum() const;

		bool cubeInFrustum(float xMin, float xMax, float yMin, float yMax, float zMin, float zMax) const;

		bool cubeInFrustum(const AABB &aabb) const;

		bool cubeCrossFrustum(float xMin, float xMax, float yMin, float yMax, float zMin, float zMax) const;
	};
}